package com.example.pan.ui.main

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.pan.http.SettingsRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import javax.inject.Inject

@HiltViewModel
class MainViewModel @Inject constructor(
    private val settingsRepository: SettingsRepository
) : ViewModel() {

    fun initThemeMode() {
        viewModelScope.launch {
            settingsRepository.themeMode.collect {
                settingsRepository.setThemeMode(it)
            }
        }
    }

}